<?php
/**
 * Description:
 *
 * @author      Eden
 * @datetime    2016/12/6 09:49
 * @copyright   Beijing CmsTop Technology Co.,Ltd.
 */

class Test extends ADM_Controller
{
    public function __construct()
    {
        parent::__construct();
    }

    public function beansdb()
    {
        $this->load->library('core/Beansdb', 'beansdb');
        // $this->beansdb->save('key', 'error');
        $con =$this->beansdb->get('/a/2016/12/3af9e91323511034754daa654ee3cb88.jpeg');
        header('Content-type: image/jpeg');
        echo $con;
    }

    public function bbs()
    {
        $array = array(
            "/a/2016/12/14eefdecac33bfbcde96e6d0c5f9ad0b.jpg",
        );

        echo json_encode($array);
    }

    public function stream()
    {
        // $res = request($tokenUrl, array('appKey' => $appKey, 'appSecret' => $secret), 'POST', array(), array('Content-Type: application/x-www-form-urlencoded'));

        $this->load->library('util/Util_Ys', null,'ys');
        // $res = $this->ys->getToken();
        // $res = $this->ys->deviceAdd('660403304', 'KDELJE');
        // $res = $this->ys->deviceDelete('660403304');
        // $res = $this->ys->deviceCapture('660403304');
        // $res = $this->ys->deviceList();
        // var_dump($res);die;
        $res = $this->ys->videoAddressLimited('660403304');
        // $res = $this->ys->videoLists();
        if ($res) {
            $d = $this->ys->getData();
            if (!empty($d)) {
                echo '<pre>';
                print_r($d);
            }
        } else {
            echo $this->ys->getError();
        }


    }

    public function img()
    {
        echo json_encode(array(
            "/a/2016/12/9d677cded4798cfe951c476718da2566.jpg",
        ));
    }

    public function up()
    {
        $this->load->view('test.html');
    }
}
